import mongoose from 'mongoose'

const Schema = mongoose.Schema

const UserSchema = new Schema({
  userName: {
    type: String,
    unique: true, // 是否唯一
    require: true // 是否必须
  },
  passwd: {
    type: String,
    require: true
  },
  email: {
    type: String
  },
  lastLoginTime: {
    type: Date,
    default: Date.now()
  },
  ip: {
    type: String
  },
  age: {
    type: Number,
    index: true
  }
})

export default mongoose.model('User', UserSchema)
